package com.example.kotlinstudy.s0

open class F {
    open fun doSomthing1() = "do1 something....."
}

class F1 : F() {
    override fun doSomthing1() = "do f 1 something....."
}

class F2 : F() {
    override fun doSomthing1() = "do f 2 something....."
}

fun spell(f: F1) {
    println("自动转换")
}

fun main() {
    val f1: F = F1()
    val f2 = F2()
    println(f1 is F)
    println(f2 is F)
    println(f2 is Any) //Any是一切类的超类 在Kotlin当中

    println((f1 as F1).doSomthing1())
    println(f1.doSomthing1()) //智能类型转换，上面转换过一次，这一行代码可以直接用
}